home *** CD-ROM | disk | FTP | other *** search
- Path: news.urz.uni-heidelberg.de!usenet
- From: Ramon Wartala <r.wartala@dkfz-heidelberg.de>
- Newsgroups: comp.lang.c
- Subject: CALL_BY_VALUE with ARRAYS ?
- Date: Mon, 11 Mar 1996 14:28:56 +0100
- Organization: dkfz Heidelberg, Abteilung Medizinische Physik
- Message-ID: <31442A98.41C6@dkfz-heidelberg.de>
- NNTP-Posting-Host: radxw2.inet.dkfz-heidelberg.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; AIX 2)
-
- Hello World,
-
-
- I've a problem which risks to break my nervs.
-
-
- How can I call a function by a pointer, and giving her
- a number of paramters which I don't know before executing ?
-
- Exp.
-
- Funcion :
-
- int foo(char a, char b , char c) {}
-
-
- void main()
- {
- int (*ptr)()=foo;
- /* .... */
- /* calling my function now ... */
- (ptr)(a_variable);
- /* ... while variable is a just a structure of 3 char. long */
- }
-
-
- The problem is, that I can define such a structure (e.g. by char
- a_variable[3]), but if I try to give it to my function foo, the
- compiler gives naturally only the reference of this 3-byte buffer
- (which is totaly normal) to my function foo.
-
- So my question could be explained with other words :
-
- How can I force the compiler ( gcc for preference) to make a
- call_by_value although with arrays ?
-
-
- Thanks in advane for your help !
-
-
- Jens
-
-
- *** Jens Astor *****
- *** jastor@jupiter.rz.fh-heilbronn.de *****
- *** University of Heidelberg, Germany *****
-